package wang.aweb.childcar.controller.api;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import wang.aweb.childcar.common.ApiRestResponse;
import wang.aweb.childcar.filter.UserFilter;
import wang.aweb.childcar.model.pojo.WqPage;
import wang.aweb.childcar.model.query.CzOrderParam;
import wang.aweb.childcar.model.vo.MoneyOrderVO;
import wang.aweb.childcar.service.CzOrderService;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/money/")
public class MoneyController {
    @Autowired
    private CzOrderService czOrderService;
    @PostMapping("getLog")
    public ApiRestResponse getLog(@RequestBody Map<String,Integer> reqMap){
        CzOrderParam czOrderParam=new CzOrderParam();
        czOrderParam.setMemberId(UserFilter.memberThreadLocal.get().getId());
        czOrderParam.setStatus(2);
        PageInfo pageInfo=czOrderService.getList(reqMap.get("page"),reqMap.get("limit"),czOrderParam);
        WqPage wqPage=new WqPage(pageInfo.getTotal(),pageInfo.getList());
        return ApiRestResponse.success(wqPage);
    }
}
